<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>请求get</h1>
    <form id="form" action="">
        <input id="ipt" type="text">
        <button id="but">
            输入查询学生ID 查询他的详细信息
        </button>
    </form>
    <script>
        const oIpt = document.querySelector("#ipt")
            const oBut = document.querySelector("#but")
            const oForm = document.querySelector("#form")
           


            oForm.onsubmit = function () {
                const uresID = oIpt.value
                const xhr = new XMLHttpRequest()
                xhr.open('get', `/woaini/${uresID}?_=${Date.now()}`)
                xhr.send()
                xhr.onreadystatechange = function(){
                    if (xhr.readyState === 4) {
                        console.log(JSON.parse(xhr.responseText));
                    }
                }
                return false
            }

    </script>
</body>
</html>